<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<%@include file="../includes/header.jsp"%>

<link href="css/jquery-ui-1.10.2.custom.min.css" rel="stylesheet"
	type="text/css" media="screen" />
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.2.custom.min.js"></script>
<script type="text/javascript" src="js/highcharts.js"></script>
<script type="text/javascript" src="js/exporting.js"></script>
<script type="text/javascript" src="js/displayRateDetail.js"></script>

<h2 class="title"><s:property value="currency1.code" />/<s:property
	value="currency2.code" /></h2>
<p class="meta">You will find below the details on the rate "<s:property
	value="currency1.name" />/<s:property value="currency2.name" />"</p>
<s:div cssClass="entry rate-detail">
	<s:hidden name="initialAskFormatted" value="%{rate.askFormatted}" />
	<s:hidden name="initialAskReciprocalFormatted" value="%{rate.askReciprocalFormatted}" />
	<s:hidden name="initialBidFormatted" value="%{rate.bidFormatted}" />
	<s:hidden name="initialBidReciprocalFormatted" value="%{rate.bidReciprocalFormatted}" />
	<s:hidden name="initialAsk" value="%{rate.ask}" />
	<s:hidden name="initialAskReciprocal" value="%{rate.askReciprocal}" />
	<s:hidden name="initialBid" value="%{rate.bid}" />
	<s:hidden name="initialBidReciprocal" value="%{rate.bidReciprocal}" />
	<s:hidden name="initialEvolution" value="" />
	<s:hidden name="initialEvolutionClass" value="" />
	<table>
		<thead>
			<tr>
				<th class="column1">Bid</th>
				<th class="column2">Ask</th>
				<th class="column3" colspan="2">Evolution</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td><span id="currentBidRate"><s:property
					value="rate.bidFormatted" /></span></td>
				<td><span id="currentAskRate"><s:property
					value="rate.askFormatted" /></span></td>
				<td><s:if test="%{rate.evolution < 0}">
					<span id="currentEvolution" class="rate-decrease"><s:property
						value="rate.evolutionFormatted" />%</span>
				</s:if><s:elseif test="%{rate.evolution > 0}">
					<span id="currentEvolution" class="rate-increase">+<s:property
						value="rate.evolutionFormatted" />%</span>
				</s:elseif><s:else>
					<span id="currentEvolution" class="rate-same">+0%</span>
				</s:else></td>
				<td id="arrowEvolution"><s:if test="%{rate.evolution < 0}">
					<img src="img/arrowDown.png"
						title="<s:property value="rate.evolutionFormatted" />%" />
				</s:if><s:elseif test="%{rate.evolution > 0}">
					<img src="img/arrowUp.png"
						title="+<s:property value="rate.evolutionFormatted" />%" />
				</s:elseif><s:else>
					<img src="img/arrowRight.png" title="+0%" />
				</s:else></td>
			</tr>
		</tbody>
	</table>
	<s:actionerror />
	<s:actionmessage />
	<s:form id="tradeSellBid" cssClass="first-form" theme="simple"
		action="trade">
		<s:hidden name="code1" value="%{currency1.code}" />
		<s:hidden name="code2" value="%{currency2.code}" />
		<s:hidden name="tradeType" value="sellBid" />
		<s:hidden id="tradeSellBidRateHidden" name="bid" value="%{rate.bid}" />
		<s:submit value="Sell" action="trade" />
		<s:property value="currency1.code" />
		<s:textfield id="tradeSellBidUnits" name="units" value="1"
			label="Units" required="true" maxlength="50" /> (you have <s:property
			value="o1.unitsFormatted" />) against <s:property
			value="currency2.code" />
		<span id="tradeSellBidCost"><s:property
			value="rate.bidFormatted" /></span>
	</s:form>
	<s:form id="tradeSellAsk" theme="simple" action="trade">
		<s:hidden name="code1" value="%{currency2.code}" />
		<s:hidden name="code2" value="%{currency1.code}" />
		<s:hidden name="tradeType" value="sellAsk" />
		<s:hidden id="tradeSellAskRateHidden" name="ask" value="%{rate.ask}" />
		<s:submit value="Sell" action="trade" />
		<s:property value="currency2.code" />
		<s:textfield id="tradeSellAskUnits" name="units" value="1"
			label="Units" required="true" maxlength="50" /> (you have <s:property
			value="o2.unitsFormatted" />) against <s:property
			value="currency1.code" />
		<span id="tradeSellAskCost"><s:property
			value="rate.askReciprocalFormatted" /></span>
	</s:form>
	<s:form id="tradeBuyAsk" theme="simple" action="trade">
		<s:hidden name="code1" value="%{currency2.code}" />
		<s:hidden name="code2" value="%{currency1.code}" />
		<s:hidden name="tradeType" value="buyAsk" />
		<s:hidden id="tradeBuyAskRateHidden" name="ask" value="%{rate.ask}" />
		<s:submit value="Buy" action="trade" />
		<s:property value="currency1.code" />
		<s:textfield id="tradeBuyAskUnits" name="units" value="1"
			label="Units" required="true" maxlength="50" /> for <s:property
			value="currency2.code" />
		<span id="tradeBuyAskCost"><s:property
			value="rate.askFormatted" /></span> (you have <s:property
			value="o2.unitsFormatted" />)
	</s:form>
	<s:form id="tradeBuyBid" theme="simple" action="trade">
		<s:hidden name="code1" value="%{currency1.code}" />
		<s:hidden name="code2" value="%{currency2.code}" />
		<s:hidden name="tradeType" value="buyBid" />
		<s:hidden id="tradeBuyBidRateHidden" name="bid" value="%{rate.bid}" />
		<s:submit value="Buy" action="trade" />
		<s:property value="currency2.code" />
		<s:textfield id="tradeBuyBidUnits" name="units" value="1"
			label="Units" required="true" maxlength="50" /> for <s:property
			value="currency1.code" />
		<span id="tradeBuyBidCost"><s:property
			value="rate.bidReciprocalFormatted" /></span> (you have <s:property
			value="o1.unitsFormatted" />)
	</s:form>
</s:div>
<s:div style="clear: both;">&nbsp;</s:div>
<s:div cssClass="entry">
	<s:submit id="graph10" value="History 10 days" theme="simple" />
	<s:submit id="graph30" value="History 30 days" theme="simple" />
	<s:submit id="graphLive" value="Live" theme="simple" />
	<s:iterator value="oldRates" status="s">
		<s:hidden cssClass="oldRateAsk" id="oldRateAsk%{#s.index}"
			value="%{ask}" />
		<s:hidden cssClass="oldRateDate" id="oldRateDate%{#s.index}"
			value="%{rateDateFormatted}" />
	</s:iterator>
	<s:div id="graph-container-10"></s:div>
	<s:div id="graph-container-30"></s:div>
	<s:div id="graph-container-live"></s:div>
</s:div>

<%@include file="../includes/footer.jsp"%>
